﻿using System;
using System.Web.Configuration;

namespace PegasCompany.Tools
{
	public class ConfigReader
	{
		private enum Keys
		{
			DefaultCountry,
			Donotreply,
			AdminMail,
			DefaultSmtpServer,
			DefaultSmtpPort,
			DefaultSmtpPassword,
			DefaultSmtpAccount,
			FCKeditorBasePath,
			FCKeditorUserFilesPath,
			TeaserWordsCount,
			SearchTeaserWrapperWordsCount,
			LocationsRowsCount,
			EmailTemplateAttachmentsPath,
			EventAttachmentPath,
			SiteContentAttachmentPath,
            SlidePhotoPath,
            SlideThumbnailPath
		}

		public static string DefaultConnectionString
		{
            get { return WebConfigurationManager.ConnectionStrings["PegasCompanyDatabase"].ConnectionString; }
		}

		private static string GetSettingValue(Keys appSettingsKey)
		{
			return WebConfigurationManager.AppSettings[appSettingsKey.ToString()];
		}

        public static string SlidePhotoPath
		{
            get { return GetSettingValue(Keys.SlidePhotoPath); }
		}

        public static string SlideThumbnailPath
		{
            get { return GetSettingValue(Keys.SlideThumbnailPath); }
		}

	    public static string EmailTemplateAttachmentsPath
	    {
            get { return GetSettingValue(Keys.EmailTemplateAttachmentsPath); }
	    }

	    public static string SiteContentAttachmentPath
		{
			get { return GetSettingValue(Keys.SiteContentAttachmentPath); }
		}

		public static string DefaultCountry
		{
			get { return GetSettingValue(Keys.DefaultCountry); }
		}

		public static string AdminMail
		{
			get { return GetSettingValue(Keys.AdminMail); }
		}

		public static string DonotreplyMail
		{
			get { return GetSettingValue(Keys.Donotreply); }
		}

		public static string DefaultSmtpServer
		{
			get { return GetSettingValue(Keys.DefaultSmtpServer); }
		}

		public static int DefaultSmtpPort
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.DefaultSmtpPort)); }
		}

		public static string DefaultSmtpPassword
		{
			get { return GetSettingValue(Keys.DefaultSmtpPassword); }
		}

		public static string FCKeditorBasePath
		{
			get { return GetSettingValue(Keys.FCKeditorBasePath); }
		}

		public static string FCKeditorUserFilesPath
		{
			get { return GetSettingValue(Keys.FCKeditorUserFilesPath); }
		}

		public static string DefaultSmtpAccount
		{
			get { return GetSettingValue(Keys.DefaultSmtpAccount); }
		}

		public static int TeaserWordsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.TeaserWordsCount)); }
		}

		public static int SearchTeaserWrapperWordsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.SearchTeaserWrapperWordsCount)); }
		}

		public static int LocationsRowsCount
		{
			get { return Convert.ToInt32(GetSettingValue(Keys.LocationsRowsCount)); }
		}
	}
}
